#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>

/**
 *	panic - halt the system
 *	@fmt: The text string to print
 *
 *	Display a message, then perform cleanups.
 *
 *	This function never returns.
 */
void panic(const char *fmt, ...)
{
	while (1)
		cpu_relax();
}

EXPORT_SYMBOL(panic);

#ifdef WANT_WARN_ON_SLOWPATH

#else
void __warn_printk(const char *fmt, ...)
{
	// va_list args;

	// pr_warn(CUT_HERE);

	// va_start(args, fmt);
	// vprintk(fmt, args);
	// va_end(args);
}
EXPORT_SYMBOL(__warn_printk);
#endif

#ifdef CONFIG_STACKPROTECTOR

/*
 * Called when gcc's -fstack-protector feature is used, and
 * gcc detects corruption of the on-stack canary value
 */
__visible void __stack_chk_fail(void)
{
	panic("stack-protector: Kernel stack is corrupted in: %pB",
		__builtin_return_address(0));
    while (1);
}
EXPORT_SYMBOL(__stack_chk_fail);

#endif
